<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>TAP::Parser - Parse TAP output - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/TAP::Parser">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./TAP::Parser.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/TAP::Parser">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/TAP::Parser">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/TAP::Parser">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/TAP::Parser">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/TAP::Parser">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/TAP::Parser">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/TAP::Parser">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/TAP::Parser">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/TAP::Parser">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/TAP::Parser">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/TAP::Parser">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/TAP::Parser">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/TAP::Parser">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/TAP::Parser">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/TAP::Parser">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/TAP::Parser">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/TAP::Parser">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/TAP::Parser">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/TAP::Parser">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/TAP::Parser">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/TAP::Parser">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/TAP::Parser">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/TAP::Parser">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/TAP::Parser">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/TAP::Parser">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/TAP::Parser">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/TAP::Parser">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/TAP::Parser">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/TAP::Parser">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/TAP::Parser">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/TAP::Parser">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/TAP::Parser">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/TAP::Parser">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/TAP::Parser">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/TAP::Parser">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/TAP::Parser">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/TAP::Parser">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/TAP::Parser">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/TAP::Parser">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/TAP::Parser">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/TAP::Parser">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/TAP::Parser">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/TAP::Parser">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/TAP::Parser">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/TAP::Parser">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/TAP::Parser">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/TAP::Parser">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/TAP::Parser">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/TAP::Parser">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/TAP::Parser">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/TAP::Parser">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/TAP::Parser">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/TAP::Parser">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/TAP::Parser">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/TAP::Parser">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/TAP::Parser">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/TAP::Parser">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/TAP::Parser">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/TAP::Parser">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/TAP::Parser">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/TAP::Parser">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/TAP::Parser">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/TAP::Parser">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/TAP::Parser">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/TAP::Parser">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/TAP::Parser">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/TAP::Parser">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/TAP::Parser">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/TAP::Parser">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/TAP::Parser">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/TAP::Parser">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/TAP::Parser">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/TAP::Parser">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/TAP::Parser">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/TAP::Parser">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/TAP::Parser">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/TAP::Parser">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/TAP::Parser">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/TAP::Parser">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/TAP::Parser">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./TAP::Parser.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/TAP::Parser">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/TAP::Parser">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/TAP::Parser">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/TAP::Parser">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/TAP::Parser">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/TAP::Parser">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/TAP::Parser">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/TAP::Parser">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/TAP::Parser">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/TAP::Parser">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/TAP::Parser">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/TAP::Parser">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/TAP::Parser">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/TAP::Parser">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/TAP::Parser">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/TAP::Parser">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/TAP::Parser">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/TAP::Parser">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/TAP::Parser">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/TAP::Parser">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/TAP::Parser">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/TAP::Parser">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/TAP::Parser">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/TAP::Parser">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/TAP::Parser">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/TAP::Parser">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/TAP::Parser">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/TAP::Parser">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/TAP::Parser">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/TAP::Parser">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/TAP::Parser">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/TAP::Parser">5.35.1</a>
          <a class="dropdown-item active" href="./TAP::Parser.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./TAP::Parser.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./TAP::Parser.html">TAP::Parser</a>
          <div id="more">
            (<a href="./TAP::Parser.txt">source</a>,
            <a href="https://metacpan.org/pod/TAP::Parser">CPAN</a>)
          </div>
            <div id="moduleversion">version 3.43</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#VERSION">VERSION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#DESCRIPTION">DESCRIPTION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#METHODS">METHODS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#Class-Methods">Class Methods</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#new">new</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#Instance-Methods">Instance Methods</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#next">next</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#run">run</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#make_grammar">make_grammar</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#make_result">make_result</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#make_iterator_factory">make_iterator_factory</a>
              </li>
          </ul>

              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#INDIVIDUAL-RESULTS">INDIVIDUAL RESULTS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#Result-types">Result types</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#Common-type-methods">Common type methods</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#type">type</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#as_string">as_string</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#raw">raw</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#is_plan">is_plan</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#is_test">is_test</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#is_comment">is_comment</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#is_bailout">is_bailout</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#is_yaml">is_yaml</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#is_unknown">is_unknown</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#is_ok">is_ok</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#plan-methods">plan methods</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#plan">plan</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#directive">directive</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#explanation">explanation</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#pragma-methods">pragma methods</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#pragmas">pragmas</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#comment-methods">comment methods</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#comment">comment</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#bailout-methods">bailout methods</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#explanation1">explanation</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#unknown-methods">unknown methods</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#test-methods">test methods</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#ok">ok</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#number">number</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#description">description</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#directive1">directive</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#explanation2">explanation</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#is_ok1">is_ok</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#is_actual_ok">is_actual_ok</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#is_unplanned">is_unplanned</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#has_skip">has_skip</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#has_todo">has_todo</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#in_todo">in_todo</a>
              </li>
          </ul>

              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#TOTAL-RESULTS">TOTAL RESULTS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#Individual-Results">Individual Results</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#passed">passed</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#failed">failed</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#actual_passed">actual_passed</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#actual_ok">actual_ok</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#actual_failed">actual_failed</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#todo">todo</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#todo_passed">todo_passed</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#todo_failed">todo_failed</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#skipped">skipped</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#Pragmas">Pragmas</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#pragma">pragma</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#pragmas1">pragmas</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#Summary-Results">Summary Results</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#plan1">plan</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#good_plan">good_plan</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#is_good_plan">is_good_plan</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#tests_planned">tests_planned</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#tests_run">tests_run</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#skip_all">skip_all</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#start_time">start_time</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#end_time">end_time</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#start_times">start_times</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#end_times">end_times</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#has_problems">has_problems</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#version">version</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#exit">exit</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#wait">wait</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#ignore_exit">ignore_exit</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#parse_errors">parse_errors</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#get_select_handles">get_select_handles</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#delete_spool">delete_spool</a>
              </li>
          </ul>

              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#CALLBACKS">CALLBACKS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#TAP-GRAMMAR">TAP GRAMMAR</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#BACKWARDS-COMPATIBILITY">BACKWARDS COMPATIBILITY</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#Differences">Differences</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#SUBCLASSING">SUBCLASSING</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#Parser-Components">Parser Components</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#Sources">Sources</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#Iterators">Iterators</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#Results">Results</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#Grammar">Grammar</a>
              </li>
          </ul>

              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#ACKNOWLEDGMENTS">ACKNOWLEDGMENTS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#AUTHORS">AUTHORS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#BUGS">BUGS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./TAP::Parser.html#COPYRIGHT-&amp;-LICENSE">COPYRIGHT &amp; LICENSE</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./TAP::Parser.html#NAME">#</a>NAME</h1>

<p>TAP::Parser - Parse <a href="https://perldoc.perl.org/5.35.0/Test::Harness::TAP">TAP</a> output</p>

<h1 id="VERSION"><a class="permalink" href="./TAP::Parser.html#VERSION">#</a>VERSION</h1>

<p>Version 3.43</p>

<h1 id="SYNOPSIS"><a class="permalink" href="./TAP::Parser.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code>use TAP::Parser;

my $parser = TAP::Parser-&gt;new( { source =&gt; $source } );

while ( my $result = $parser-&gt;next ) {
    print $result-&gt;as_string;
}</code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="./TAP::Parser.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p><code>TAP::Parser</code> is designed to produce a proper parse of TAP output. For an example of how to run tests through this module, see the simple harnesses <code>examples/</code>.</p>

<p>There&#39;s a wiki dedicated to the Test Anything Protocol:</p>

<p><a href="http://testanything.org">http://testanything.org</a></p>

<p>It includes the TAP::Parser Cookbook:</p>

<p><a href="http://testanything.org/testing-with-tap/perl/tap::parser-cookbook.html">http://testanything.org/testing-with-tap/perl/tap::parser-cookbook.html</a></p>

<h1 id="METHODS"><a class="permalink" href="./TAP::Parser.html#METHODS">#</a>METHODS</h1>

<h2 id="Class-Methods"><a class="permalink" href="./TAP::Parser.html#Class-Methods">#</a><a id="Class"></a>Class Methods</h2>

<h3 id="new"><a class="permalink" href="./TAP::Parser.html#new">#</a><code>new</code></h3>

<pre><code>my $parser = TAP::Parser-&gt;new(\%args);</code></pre>

<p>Returns a new <code>TAP::Parser</code> object.</p>

<p>The arguments should be a hashref with <i>one</i> of the following keys:</p>

<ul>

<li><p><code>source</code></p>

<p><i>CHANGED in 3.18</i></p>

<p>This is the preferred method of passing input to the constructor.</p>

<p>The <code>source</code> is used to create a <a href="./TAP::Parser::Source.html">TAP::Parser::Source</a> that is passed to the <a href="./TAP::Parser.html#iterator_factory_class">&quot;iterator_factory_class&quot;</a> which in turn figures out how to handle the source and creates a &lt;TAP::Parser::Iterator&gt; for it. The iterator is used by the parser to read in the TAP stream.</p>

<p>To configure the <i>IteratorFactory</i> use the <code>sources</code> parameter below.</p>

<p>Note that <code>source</code>, <code>tap</code> and <code>exec</code> are <i>mutually exclusive</i>.</p>

</li>
<li><p><code>tap</code></p>

<p><i>CHANGED in 3.18</i></p>

<p>The value should be the complete TAP output.</p>

<p>The <i>tap</i> is used to create a <a href="./TAP::Parser::Source.html">TAP::Parser::Source</a> that is passed to the <a href="./TAP::Parser.html#iterator_factory_class">&quot;iterator_factory_class&quot;</a> which in turn figures out how to handle the source and creates a &lt;TAP::Parser::Iterator&gt; for it. The iterator is used by the parser to read in the TAP stream.</p>

<p>To configure the <i>IteratorFactory</i> use the <code>sources</code> parameter below.</p>

<p>Note that <code>source</code>, <code>tap</code> and <code>exec</code> are <i>mutually exclusive</i>.</p>

</li>
<li><p><code>exec</code></p>

<p>Must be passed an array reference.</p>

<p>The <i>exec</i> array ref is used to create a <a href="./TAP::Parser::Source.html">TAP::Parser::Source</a> that is passed to the <a href="./TAP::Parser.html#iterator_factory_class">&quot;iterator_factory_class&quot;</a> which in turn figures out how to handle the source and creates a &lt;TAP::Parser::Iterator&gt; for it. The iterator is used by the parser to read in the TAP stream.</p>

<p>By default the <a href="./TAP::Parser::SourceHandler::Executable.html">TAP::Parser::SourceHandler::Executable</a> class will create a <a href="./TAP::Parser::Iterator::Process.html">TAP::Parser::Iterator::Process</a> object to handle the source. This passes the array reference strings as command arguments to <a href="./IPC::Open3.html">IPC::Open3::open3</a>:</p>

<pre><code class="plaintext">exec =&gt; [ &#39;/usr/bin/ruby&#39;, &#39;t/my_test.rb&#39; ]</code></pre>

<p>If any <code>test_args</code> are given they will be appended to the end of the command argument list.</p>

<p>To configure the <i>IteratorFactory</i> use the <code>sources</code> parameter below.</p>

<p>Note that <code>source</code>, <code>tap</code> and <code>exec</code> are <i>mutually exclusive</i>.</p>

</li>
</ul>

<p>The following keys are optional.</p>

<ul>

<li><p><code>sources</code></p>

<p><i>NEW to 3.18</i>.</p>

<p>If set, <code>sources</code> must be a hashref containing the names of the <a href="./TAP::Parser::SourceHandler.html">TAP::Parser::SourceHandler</a>s to load and/or configure. The values are a hash of configuration that will be accessible to the source handlers via <a href="./TAP::Parser::Source.html#config_for">&quot;config_for&quot; in TAP::Parser::Source</a>.</p>

<p>For example:</p>

<pre><code>sources =&gt; {
  Perl =&gt; { exec =&gt; &#39;/path/to/custom/perl&#39; },
  File =&gt; { extensions =&gt; [ &#39;.tap&#39;, &#39;.txt&#39; ] },
  MyCustom =&gt; { some =&gt; &#39;config&#39; },
}</code></pre>

<p>This will cause <code>TAP::Parser</code> to pass custom configuration to two of the built- in source handlers - <a href="./TAP::Parser::SourceHandler::Perl.html">TAP::Parser::SourceHandler::Perl</a>, <a href="./TAP::Parser::SourceHandler::File.html">TAP::Parser::SourceHandler::File</a> - and attempt to load the <code>MyCustom</code> class. See <a href="./TAP::Parser::IteratorFactory.html#load_handlers">&quot;load_handlers&quot; in TAP::Parser::IteratorFactory</a> for more detail.</p>

<p>The <code>sources</code> parameter affects how <code>source</code>, <code>tap</code> and <code>exec</code> parameters are handled.</p>

<p>See <a href="./TAP::Parser::IteratorFactory.html">TAP::Parser::IteratorFactory</a>, <a href="./TAP::Parser::SourceHandler.html">TAP::Parser::SourceHandler</a> and subclasses for more details.</p>

</li>
<li><p><code>callback</code></p>

<p>If present, each callback corresponding to a given result type will be called with the result as the argument if the <code>run</code> method is used:</p>

<pre><code>my %callbacks = (
    test    =&gt; \&amp;test_callback,
    plan    =&gt; \&amp;plan_callback,
    comment =&gt; \&amp;comment_callback,
    bailout =&gt; \&amp;bailout_callback,
    unknown =&gt; \&amp;unknown_callback,
);

my $aggregator = TAP::Parser::Aggregator-&gt;new;
for my $file ( @test_files ) {
    my $parser = TAP::Parser-&gt;new(
        {
            source    =&gt; $file,
            callbacks =&gt; \%callbacks,
        }
    );
    $parser-&gt;run;
    $aggregator-&gt;add( $file, $parser );
}</code></pre>

</li>
<li><p><code>switches</code></p>

<p>If using a Perl file as a source, optional switches may be passed which will be used when invoking the perl executable.</p>

<pre><code>my $parser = TAP::Parser-&gt;new( {
    source   =&gt; $test_file,
    switches =&gt; [ &#39;-Ilib&#39; ],
} );</code></pre>

</li>
<li><p><code>test_args</code></p>

<p>Used in conjunction with the <code>source</code> and <code>exec</code> option to supply a reference to an <code>@ARGV</code> style array of arguments to pass to the test program.</p>

</li>
<li><p><code>spool</code></p>

<p>If passed a filehandle will write a copy of all parsed TAP to that handle.</p>

</li>
<li><p><code>merge</code></p>

<p>If false, STDERR is not captured (though it is &#39;relayed&#39; to keep it somewhat synchronized with STDOUT.)</p>

<p>If true, STDERR and STDOUT are the same filehandle. This may cause breakage if STDERR contains anything resembling TAP format, but does allow exact synchronization.</p>

<p>Subtleties of this behavior may be platform-dependent and may change in the future.</p>

</li>
<li><p><code>grammar_class</code></p>

<p>This option was introduced to let you easily customize which <i>grammar</i> class the parser should use. It defaults to <a href="./TAP::Parser::Grammar.html">TAP::Parser::Grammar</a>.</p>

<p>See also <a href="./TAP::Parser.html#make_grammar">&quot;make_grammar&quot;</a>.</p>

</li>
<li><p><code>result_factory_class</code></p>

<p>This option was introduced to let you easily customize which <i>result</i> factory class the parser should use. It defaults to <a href="./TAP::Parser::ResultFactory.html">TAP::Parser::ResultFactory</a>.</p>

<p>See also <a href="./TAP::Parser.html#make_result">&quot;make_result&quot;</a>.</p>

</li>
<li><p><code>iterator_factory_class</code></p>

<p><i>CHANGED in 3.18</i></p>

<p>This option was introduced to let you easily customize which <i>iterator</i> factory class the parser should use. It defaults to <a href="./TAP::Parser::IteratorFactory.html">TAP::Parser::IteratorFactory</a>.</p>

</li>
</ul>

<h2 id="Instance-Methods"><a class="permalink" href="./TAP::Parser.html#Instance-Methods">#</a><a id="Instance"></a>Instance Methods</h2>

<h3 id="next"><a class="permalink" href="./TAP::Parser.html#next">#</a><code>next</code></h3>

<pre><code>my $parser = TAP::Parser-&gt;new( { source =&gt; $file } );
while ( my $result = $parser-&gt;next ) {
    print $result-&gt;as_string, &quot;\n&quot;;
}</code></pre>

<p>This method returns the results of the parsing, one result at a time. Note that it is destructive. You can&#39;t rewind and examine previous results.</p>

<p>If callbacks are used, they will be issued before this call returns.</p>

<p>Each result returned is a subclass of <a href="./TAP::Parser::Result.html">TAP::Parser::Result</a>. See that module and related classes for more information on how to use them.</p>

<h3 id="run"><a class="permalink" href="./TAP::Parser.html#run">#</a><code>run</code></h3>

<pre><code>$parser-&gt;run;</code></pre>

<p>This method merely runs the parser and parses all of the TAP.</p>

<h3 id="make_grammar"><a class="permalink" href="./TAP::Parser.html#make_grammar">#</a><code>make_grammar</code></h3>

<p>Make a new <a href="./TAP::Parser::Grammar.html">TAP::Parser::Grammar</a> object and return it. Passes through any arguments given.</p>

<p>The <code>grammar_class</code> can be customized, as described in <a href="./TAP::Parser.html#new">&quot;new&quot;</a>.</p>

<h3 id="make_result"><a class="permalink" href="./TAP::Parser.html#make_result">#</a><code>make_result</code></h3>

<p>Make a new <a href="./TAP::Parser::Result.html">TAP::Parser::Result</a> object using the parser&#39;s <a href="./TAP::Parser::ResultFactory.html">TAP::Parser::ResultFactory</a>, and return it. Passes through any arguments given.</p>

<p>The <code>result_factory_class</code> can be customized, as described in <a href="./TAP::Parser.html#new">&quot;new&quot;</a>.</p>

<h3 id="make_iterator_factory"><a class="permalink" href="./TAP::Parser.html#make_iterator_factory">#</a><code>make_iterator_factory</code></h3>

<p><i>NEW to 3.18</i>.</p>

<p>Make a new <a href="./TAP::Parser::IteratorFactory.html">TAP::Parser::IteratorFactory</a> object and return it. Passes through any arguments given.</p>

<p><code>iterator_factory_class</code> can be customized, as described in <a href="./TAP::Parser.html#new">&quot;new&quot;</a>.</p>

<h1 id="INDIVIDUAL-RESULTS"><a class="permalink" href="./TAP::Parser.html#INDIVIDUAL-RESULTS">#</a><a id="INDIVIDUAL"></a>INDIVIDUAL RESULTS</h1>

<p>If you&#39;ve read this far in the docs, you&#39;ve seen this:</p>

<pre><code>while ( my $result = $parser-&gt;next ) {
    print $result-&gt;as_string;
}</code></pre>

<p>Each result returned is a <a href="./TAP::Parser::Result.html">TAP::Parser::Result</a> subclass, referred to as <i>result types</i>.</p>

<h2 id="Result-types"><a class="permalink" href="./TAP::Parser.html#Result-types">#</a><a id="Result"></a>Result types</h2>

<p>Basically, you fetch individual results from the TAP. The six types, with examples of each, are as follows:</p>

<ul>

<li><p>Version</p>

<pre><code class="plaintext">TAP version 12</code></pre>

</li>
<li><p>Plan</p>

<pre><code class="plaintext">1..42</code></pre>

</li>
<li><p>Pragma</p>

<pre><code class="plaintext">pragma +strict</code></pre>

</li>
<li><p>Test</p>

<pre><code class="plaintext">ok 3 - We should start with some foobar!</code></pre>

</li>
<li><p>Comment</p>

<pre><code class="plaintext"># Hope we don&#39;t use up the foobar.</code></pre>

</li>
<li><p>Bailout</p>

<pre><code class="plaintext">Bail out!  We ran out of foobar!</code></pre>

</li>
<li><p>Unknown</p>

<pre><code class="plaintext">... yo, this ain&#39;t TAP! ...</code></pre>

</li>
</ul>

<p>Each result fetched is a result object of a different type. There are common methods to each result object and different types may have methods unique to their type. Sometimes a type method may be overridden in a subclass, but its use is guaranteed to be identical.</p>

<h2 id="Common-type-methods"><a class="permalink" href="./TAP::Parser.html#Common-type-methods">#</a><a id="Common"></a>Common type methods</h2>

<h3 id="type"><a class="permalink" href="./TAP::Parser.html#type">#</a><code>type</code></h3>

<p>Returns the type of result, such as <code>comment</code> or <code>test</code>.</p>

<h3 id="as_string"><a class="permalink" href="./TAP::Parser.html#as_string">#</a><code>as_string</code></h3>

<p>Prints a string representation of the token. This might not be the exact output, however. Tests will have test numbers added if not present, TODO and SKIP directives will be capitalized and, in general, things will be cleaned up. If you need the original text for the token, see the <code>raw</code> method.</p>

<h3 id="raw"><a class="permalink" href="./TAP::Parser.html#raw">#</a><code>raw</code></h3>

<p>Returns the original line of text which was parsed.</p>

<h3 id="is_plan"><a class="permalink" href="./TAP::Parser.html#is_plan">#</a><code>is_plan</code></h3>

<p>Indicates whether or not this is the test plan line.</p>

<h3 id="is_test"><a class="permalink" href="./TAP::Parser.html#is_test">#</a><code>is_test</code></h3>

<p>Indicates whether or not this is a test line.</p>

<h3 id="is_comment"><a class="permalink" href="./TAP::Parser.html#is_comment">#</a><code>is_comment</code></h3>

<p>Indicates whether or not this is a comment. Comments will generally only appear in the TAP stream if STDERR is merged to STDOUT. See the <code>merge</code> option.</p>

<h3 id="is_bailout"><a class="permalink" href="./TAP::Parser.html#is_bailout">#</a><code>is_bailout</code></h3>

<p>Indicates whether or not this is bailout line.</p>

<h3 id="is_yaml"><a class="permalink" href="./TAP::Parser.html#is_yaml">#</a><code>is_yaml</code></h3>

<p>Indicates whether or not the current item is a YAML block.</p>

<h3 id="is_unknown"><a class="permalink" href="./TAP::Parser.html#is_unknown">#</a><code>is_unknown</code></h3>

<p>Indicates whether or not the current line could be parsed.</p>

<h3 id="is_ok"><a class="permalink" href="./TAP::Parser.html#is_ok">#</a><code>is_ok</code></h3>

<pre><code>if ( $result-&gt;is_ok ) { ... }</code></pre>

<p>Reports whether or not a given result has passed. Anything which is <b>not</b> a test result returns true. This is merely provided as a convenient shortcut which allows you to do this:</p>

<pre><code>my $parser = TAP::Parser-&gt;new( { source =&gt; $source } );
while ( my $result = $parser-&gt;next ) {
    # only print failing results
    print $result-&gt;as_string unless $result-&gt;is_ok;
}</code></pre>

<h2 id="plan-methods"><a class="permalink" href="./TAP::Parser.html#plan-methods">#</a><a id="plan2"></a><code>plan</code> methods</h2>

<pre><code>if ( $result-&gt;is_plan ) { ... }</code></pre>

<p>If the above evaluates as true, the following methods will be available on the <code>$result</code> object.</p>

<h3 id="plan"><a class="permalink" href="./TAP::Parser.html#plan">#</a><code>plan</code></h3>

<pre><code>if ( $result-&gt;is_plan ) {
   print $result-&gt;plan;
}</code></pre>

<p>This is merely a synonym for <code>as_string</code>.</p>

<h3 id="directive"><a class="permalink" href="./TAP::Parser.html#directive">#</a><code>directive</code></h3>

<pre><code>my $directive = $result-&gt;directive;</code></pre>

<p>If a SKIP directive is included with the plan, this method will return it.</p>

<pre><code class="plaintext">1..0 # SKIP: why bother?</code></pre>

<h3 id="explanation"><a class="permalink" href="./TAP::Parser.html#explanation">#</a><code>explanation</code></h3>

<pre><code>my $explanation = $result-&gt;explanation;</code></pre>

<p>If a SKIP directive was included with the plan, this method will return the explanation, if any.</p>

<h2 id="pragma-methods"><a class="permalink" href="./TAP::Parser.html#pragma-methods">#</a><a id="pragma1"></a><code>pragma</code> methods</h2>

<pre><code>if ( $result-&gt;is_pragma ) { ... }</code></pre>

<p>If the above evaluates as true, the following methods will be available on the <code>$result</code> object.</p>

<h3 id="pragmas"><a class="permalink" href="./TAP::Parser.html#pragmas">#</a><code>pragmas</code></h3>

<p>Returns a list of pragmas each of which is a + or - followed by the pragma name.</p>

<h2 id="comment-methods"><a class="permalink" href="./TAP::Parser.html#comment-methods">#</a><a id="comment1"></a><code>comment</code> methods</h2>

<pre><code>if ( $result-&gt;is_comment ) { ... }</code></pre>

<p>If the above evaluates as true, the following methods will be available on the <code>$result</code> object.</p>

<h3 id="comment"><a class="permalink" href="./TAP::Parser.html#comment">#</a><code>comment</code></h3>

<pre><code>if ( $result-&gt;is_comment ) {
    my $comment = $result-&gt;comment;
    print &quot;I have something to say:  $comment&quot;;
}</code></pre>

<h2 id="bailout-methods"><a class="permalink" href="./TAP::Parser.html#bailout-methods">#</a><a id="bailout"></a><code>bailout</code> methods</h2>

<pre><code>if ( $result-&gt;is_bailout ) { ... }</code></pre>

<p>If the above evaluates as true, the following methods will be available on the <code>$result</code> object.</p>

<h3 id="explanation1"><a class="permalink" href="./TAP::Parser.html#explanation1">#</a><code>explanation</code></h3>

<pre><code>if ( $result-&gt;is_bailout ) {
    my $explanation = $result-&gt;explanation;
    print &quot;We bailed out because ($explanation)&quot;;
}</code></pre>

<p>If, and only if, a token is a bailout token, you can get an &quot;explanation&quot; via this method. The explanation is the text after the mystical &quot;Bail out!&quot; words which appear in the tap output.</p>

<h2 id="unknown-methods"><a class="permalink" href="./TAP::Parser.html#unknown-methods">#</a><a id="unknown"></a><code>unknown</code> methods</h2>

<pre><code>if ( $result-&gt;is_unknown ) { ... }</code></pre>

<p>There are no unique methods for unknown results.</p>

<h2 id="test-methods"><a class="permalink" href="./TAP::Parser.html#test-methods">#</a><a id="test"></a><code>test</code> methods</h2>

<pre><code>if ( $result-&gt;is_test ) { ... }</code></pre>

<p>If the above evaluates as true, the following methods will be available on the <code>$result</code> object.</p>

<h3 id="ok"><a class="permalink" href="./TAP::Parser.html#ok">#</a><code>ok</code></h3>

<pre><code>my $ok = $result-&gt;ok;</code></pre>

<p>Returns the literal text of the <code>ok</code> or <code>not ok</code> status.</p>

<h3 id="number"><a class="permalink" href="./TAP::Parser.html#number">#</a><code>number</code></h3>

<pre><code>my $test_number = $result-&gt;number;</code></pre>

<p>Returns the number of the test, even if the original TAP output did not supply that number.</p>

<h3 id="description"><a class="permalink" href="./TAP::Parser.html#description">#</a><code>description</code></h3>

<pre><code>my $description = $result-&gt;description;</code></pre>

<p>Returns the description of the test, if any. This is the portion after the test number but before the directive.</p>

<h3 id="directive1"><a class="permalink" href="./TAP::Parser.html#directive1">#</a><code>directive</code></h3>

<pre><code>my $directive = $result-&gt;directive;</code></pre>

<p>Returns either <code>TODO</code> or <code>SKIP</code> if either directive was present for a test line.</p>

<h3 id="explanation2"><a class="permalink" href="./TAP::Parser.html#explanation2">#</a><code>explanation</code></h3>

<pre><code>my $explanation = $result-&gt;explanation;</code></pre>

<p>If a test had either a <code>TODO</code> or <code>SKIP</code> directive, this method will return the accompanying explanation, if present.</p>

<pre><code class="plaintext">not ok 17 - &#39;Pigs can fly&#39; # TODO not enough acid</code></pre>

<p>For the above line, the explanation is <i>not enough acid</i>.</p>

<h3 id="is_ok1"><a class="permalink" href="./TAP::Parser.html#is_ok1">#</a><code>is_ok</code></h3>

<pre><code>if ( $result-&gt;is_ok ) { ... }</code></pre>

<p>Returns a boolean value indicating whether or not the test passed. Remember that for TODO tests, the test always passes.</p>

<p><b>Note:</b> this was formerly <code>passed</code>. The latter method is deprecated and will issue a warning.</p>

<h3 id="is_actual_ok"><a class="permalink" href="./TAP::Parser.html#is_actual_ok">#</a><code>is_actual_ok</code></h3>

<pre><code>if ( $result-&gt;is_actual_ok ) { ... }</code></pre>

<p>Returns a boolean value indicating whether or not the test passed, regardless of its TODO status.</p>

<p><b>Note:</b> this was formerly <code>actual_passed</code>. The latter method is deprecated and will issue a warning.</p>

<h3 id="is_unplanned"><a class="permalink" href="./TAP::Parser.html#is_unplanned">#</a><code>is_unplanned</code></h3>

<pre><code>if ( $test-&gt;is_unplanned ) { ... }</code></pre>

<p>If a test number is greater than the number of planned tests, this method will return true. Unplanned tests will <i>always</i> return false for <code>is_ok</code>, regardless of whether or not the test <code>has_todo</code> (see <a href="./TAP::Parser::Result::Test.html">TAP::Parser::Result::Test</a> for more information about this).</p>

<h3 id="has_skip"><a class="permalink" href="./TAP::Parser.html#has_skip">#</a><code>has_skip</code></h3>

<pre><code>if ( $result-&gt;has_skip ) { ... }</code></pre>

<p>Returns a boolean value indicating whether or not this test had a SKIP directive.</p>

<h3 id="has_todo"><a class="permalink" href="./TAP::Parser.html#has_todo">#</a><code>has_todo</code></h3>

<pre><code>if ( $result-&gt;has_todo ) { ... }</code></pre>

<p>Returns a boolean value indicating whether or not this test had a TODO directive.</p>

<p>Note that TODO tests <i>always</i> pass. If you need to know whether or not they really passed, check the <code>is_actual_ok</code> method.</p>

<h3 id="in_todo"><a class="permalink" href="./TAP::Parser.html#in_todo">#</a><code>in_todo</code></h3>

<pre><code>if ( $parser-&gt;in_todo ) { ... }</code></pre>

<p>True while the most recent result was a TODO. Becomes true before the TODO result is returned and stays true until just before the next non- TODO test is returned.</p>

<h1 id="TOTAL-RESULTS"><a class="permalink" href="./TAP::Parser.html#TOTAL-RESULTS">#</a><a id="TOTAL"></a>TOTAL RESULTS</h1>

<p>After parsing the TAP, there are many methods available to let you dig through the results and determine what is meaningful to you.</p>

<h2 id="Individual-Results"><a class="permalink" href="./TAP::Parser.html#Individual-Results">#</a><a id="Individual"></a>Individual Results</h2>

<p>These results refer to individual tests which are run.</p>

<h3 id="passed"><a class="permalink" href="./TAP::Parser.html#passed">#</a><code>passed</code></h3>

<pre><code>my @passed = $parser-&gt;passed; # the test numbers which passed
my $passed = $parser-&gt;passed; # the number of tests which passed</code></pre>

<p>This method lets you know which (or how many) tests passed. If a test failed but had a TODO directive, it will be counted as a passed test.</p>

<h3 id="failed"><a class="permalink" href="./TAP::Parser.html#failed">#</a><code>failed</code></h3>

<pre><code>my @failed = $parser-&gt;failed; # the test numbers which failed
my $failed = $parser-&gt;failed; # the number of tests which failed</code></pre>

<p>This method lets you know which (or how many) tests failed. If a test passed but had a TODO directive, it will <b>NOT</b> be counted as a failed test.</p>

<h3 id="actual_passed"><a class="permalink" href="./TAP::Parser.html#actual_passed">#</a><code>actual_passed</code></h3>

<pre><code># the test numbers which actually passed
my @actual_passed = $parser-&gt;actual_passed;

# the number of tests which actually passed
my $actual_passed = $parser-&gt;actual_passed;</code></pre>

<p>This method lets you know which (or how many) tests actually passed, regardless of whether or not a TODO directive was found.</p>

<h3 id="actual_ok"><a class="permalink" href="./TAP::Parser.html#actual_ok">#</a><code>actual_ok</code></h3>

<p>This method is a synonym for <code>actual_passed</code>.</p>

<h3 id="actual_failed"><a class="permalink" href="./TAP::Parser.html#actual_failed">#</a><code>actual_failed</code></h3>

<pre><code># the test numbers which actually failed
my @actual_failed = $parser-&gt;actual_failed;

# the number of tests which actually failed
my $actual_failed = $parser-&gt;actual_failed;</code></pre>

<p>This method lets you know which (or how many) tests actually failed, regardless of whether or not a TODO directive was found.</p>

<h3 id="todo"><a class="permalink" href="./TAP::Parser.html#todo">#</a><code>todo</code></h3>

<pre><code>my @todo = $parser-&gt;todo; # the test numbers with todo directives
my $todo = $parser-&gt;todo; # the number of tests with todo directives</code></pre>

<p>This method lets you know which (or how many) tests had TODO directives.</p>

<h3 id="todo_passed"><a class="permalink" href="./TAP::Parser.html#todo_passed">#</a><code>todo_passed</code></h3>

<pre><code># the test numbers which unexpectedly succeeded
my @todo_passed = $parser-&gt;todo_passed;

# the number of tests which unexpectedly succeeded
my $todo_passed = $parser-&gt;todo_passed;</code></pre>

<p>This method lets you know which (or how many) tests actually passed but were declared as &quot;TODO&quot; tests.</p>

<h3 id="todo_failed"><a class="permalink" href="./TAP::Parser.html#todo_failed">#</a><code>todo_failed</code></h3>

<pre><code class="plaintext"># deprecated in favor of &#39;todo_passed&#39;.  This method was horribly misnamed.</code></pre>

<p>This was a badly misnamed method. It indicates which TODO tests unexpectedly succeeded. Will now issue a warning and call <code>todo_passed</code>.</p>

<h3 id="skipped"><a class="permalink" href="./TAP::Parser.html#skipped">#</a><code>skipped</code></h3>

<pre><code>my @skipped = $parser-&gt;skipped; # the test numbers with SKIP directives
my $skipped = $parser-&gt;skipped; # the number of tests with SKIP directives</code></pre>

<p>This method lets you know which (or how many) tests had SKIP directives.</p>

<h2 id="Pragmas"><a class="permalink" href="./TAP::Parser.html#Pragmas">#</a>Pragmas</h2>

<h3 id="pragma"><a class="permalink" href="./TAP::Parser.html#pragma">#</a><code>pragma</code></h3>

<p>Get or set a pragma. To get the state of a pragma:</p>

<pre><code>if ( $p-&gt;pragma(&#39;strict&#39;) ) {
    # be strict
}</code></pre>

<p>To set the state of a pragma:</p>

<pre><code>$p-&gt;pragma(&#39;strict&#39;, 1); # enable strict mode</code></pre>

<h3 id="pragmas1"><a class="permalink" href="./TAP::Parser.html#pragmas1">#</a><code>pragmas</code></h3>

<p>Get a list of all the currently enabled pragmas:</p>

<pre><code>my @pragmas_enabled = $p-&gt;pragmas;</code></pre>

<h2 id="Summary-Results"><a class="permalink" href="./TAP::Parser.html#Summary-Results">#</a><a id="Summary"></a>Summary Results</h2>

<p>These results are &quot;meta&quot; information about the total results of an individual test program.</p>

<h3 id="plan1"><a class="permalink" href="./TAP::Parser.html#plan1">#</a><code>plan</code></h3>

<pre><code>my $plan = $parser-&gt;plan;</code></pre>

<p>Returns the test plan, if found.</p>

<h3 id="good_plan"><a class="permalink" href="./TAP::Parser.html#good_plan">#</a><code>good_plan</code></h3>

<p>Deprecated. Use <code>is_good_plan</code> instead.</p>

<h3 id="is_good_plan"><a class="permalink" href="./TAP::Parser.html#is_good_plan">#</a><code>is_good_plan</code></h3>

<pre><code>if ( $parser-&gt;is_good_plan ) { ... }</code></pre>

<p>Returns a boolean value indicating whether or not the number of tests planned matches the number of tests run.</p>

<p><b>Note:</b> this was formerly <code>good_plan</code>. The latter method is deprecated and will issue a warning.</p>

<p>And since we&#39;re on that subject ...</p>

<h3 id="tests_planned"><a class="permalink" href="./TAP::Parser.html#tests_planned">#</a><code>tests_planned</code></h3>

<pre><code>print $parser-&gt;tests_planned;</code></pre>

<p>Returns the number of tests planned, according to the plan. For example, a plan of &#39;1..17&#39; will mean that 17 tests were planned.</p>

<h3 id="tests_run"><a class="permalink" href="./TAP::Parser.html#tests_run">#</a><code>tests_run</code></h3>

<pre><code>print $parser-&gt;tests_run;</code></pre>

<p>Returns the number of tests which actually were run. Hopefully this will match the number of <code>$parser-&gt;tests_planned</code>.</p>

<h3 id="skip_all"><a class="permalink" href="./TAP::Parser.html#skip_all">#</a><code>skip_all</code></h3>

<p>Returns a true value (actually the reason for skipping) if all tests were skipped.</p>

<h3 id="start_time"><a class="permalink" href="./TAP::Parser.html#start_time">#</a><code>start_time</code></h3>

<p>Returns the wall-clock time when the Parser was created.</p>

<h3 id="end_time"><a class="permalink" href="./TAP::Parser.html#end_time">#</a><code>end_time</code></h3>

<p>Returns the wall-clock time when the end of TAP input was seen.</p>

<h3 id="start_times"><a class="permalink" href="./TAP::Parser.html#start_times">#</a><code>start_times</code></h3>

<p>Returns the CPU times (like <a href="perlfunc.html#times">&quot;times&quot; in perlfunc</a> when the Parser was created.</p>

<h3 id="end_times"><a class="permalink" href="./TAP::Parser.html#end_times">#</a><code>end_times</code></h3>

<p>Returns the CPU times (like <a href="perlfunc.html#times">&quot;times&quot; in perlfunc</a> when the end of TAP input was seen.</p>

<h3 id="has_problems"><a class="permalink" href="./TAP::Parser.html#has_problems">#</a><code>has_problems</code></h3>

<pre><code>if ( $parser-&gt;has_problems ) {
    ...
}</code></pre>

<p>This is a &#39;catch-all&#39; method which returns true if any tests have currently failed, any TODO tests unexpectedly succeeded, or any parse errors occurred.</p>

<h3 id="version"><a class="permalink" href="./TAP::Parser.html#version">#</a><code>version</code></h3>

<pre><code>$parser-&gt;version;</code></pre>

<p>Once the parser is done, this will return the version number for the parsed TAP. Version numbers were introduced with TAP version 13 so if no version number is found version 12 is assumed.</p>

<h3 id="exit"><a class="permalink" href="./TAP::Parser.html#exit">#</a><code>exit</code></h3>

<pre><code>$parser-&gt;exit;</code></pre>

<p>Once the parser is done, this will return the exit status. If the parser ran an executable, it returns the exit status of the executable.</p>

<h3 id="wait"><a class="permalink" href="./TAP::Parser.html#wait">#</a><code>wait</code></h3>

<pre><code>$parser-&gt;wait;</code></pre>

<p>Once the parser is done, this will return the wait status. If the parser ran an executable, it returns the wait status of the executable. Otherwise, this merely returns the <code>exit</code> status.</p>

<h2 id="ignore_exit"><a class="permalink" href="./TAP::Parser.html#ignore_exit">#</a><code>ignore_exit</code></h2>

<pre><code>$parser-&gt;ignore_exit(1);</code></pre>

<p>Tell the parser to ignore the exit status from the test when determining whether the test passed. Normally tests with non-zero exit status are considered to have failed even if all individual tests passed. In cases where it is not possible to control the exit value of the test script use this option to ignore it.</p>

<h3 id="parse_errors"><a class="permalink" href="./TAP::Parser.html#parse_errors">#</a><code>parse_errors</code></h3>

<pre><code>my @errors = $parser-&gt;parse_errors; # the parser errors
my $errors = $parser-&gt;parse_errors; # the number of parser_errors</code></pre>

<p>Fortunately, all TAP output is perfect. In the event that it is not, this method will return parser errors. Note that a junk line which the parser does not recognize is <code>not</code> an error. This allows this parser to handle future versions of TAP. The following are all TAP errors reported by the parser:</p>

<ul>

<li><p>Misplaced plan</p>

<p>The plan (for example, &#39;1..5&#39;), must only come at the beginning or end of the TAP output.</p>

</li>
<li><p>No plan</p>

<p>Gotta have a plan!</p>

</li>
<li><p>More than one plan</p>

<pre><code class="plaintext">1..3
ok 1 - input file opened
not ok 2 - first line of the input valid # todo some data
ok 3 read the rest of the file
1..3</code></pre>

<p>Right. Very funny. Don&#39;t do that.</p>

</li>
<li><p>Test numbers out of sequence</p>

<pre><code class="plaintext">1..3
ok 1 - input file opened
not ok 2 - first line of the input valid # todo some data
ok 2 read the rest of the file</code></pre>

<p>That last test line above should have the number &#39;3&#39; instead of &#39;2&#39;.</p>

<p>Note that it&#39;s perfectly acceptable for some lines to have test numbers and others to not have them. However, when a test number is found, it must be in sequence. The following is also an error:</p>

<pre><code class="plaintext">1..3
ok 1 - input file opened
not ok - first line of the input valid # todo some data
ok 2 read the rest of the file</code></pre>

<p>But this is not:</p>

<pre><code class="plaintext">1..3
ok  - input file opened
not ok - first line of the input valid # todo some data
ok 3 read the rest of the file</code></pre>

</li>
</ul>

<h3 id="get_select_handles"><a class="permalink" href="./TAP::Parser.html#get_select_handles">#</a><code>get_select_handles</code></h3>

<p>Get an a list of file handles which can be passed to <code>select</code> to determine the readiness of this parser.</p>

<h3 id="delete_spool"><a class="permalink" href="./TAP::Parser.html#delete_spool">#</a><code>delete_spool</code></h3>

<p>Delete and return the spool.</p>

<pre><code>my $fh = $parser-&gt;delete_spool;</code></pre>

<h1 id="CALLBACKS"><a class="permalink" href="./TAP::Parser.html#CALLBACKS">#</a>CALLBACKS</h1>

<p>As mentioned earlier, a &quot;callback&quot; key may be added to the <code>TAP::Parser</code> constructor. If present, each callback corresponding to a given result type will be called with the result as the argument if the <code>run</code> method is used. The callback is expected to be a subroutine reference (or anonymous subroutine) which is invoked with the parser result as its argument.</p>

<pre><code>my %callbacks = (
    test    =&gt; \&amp;test_callback,
    plan    =&gt; \&amp;plan_callback,
    comment =&gt; \&amp;comment_callback,
    bailout =&gt; \&amp;bailout_callback,
    unknown =&gt; \&amp;unknown_callback,
);

my $aggregator = TAP::Parser::Aggregator-&gt;new;
for my $file ( @test_files ) {
    my $parser = TAP::Parser-&gt;new(
        {
            source    =&gt; $file,
            callbacks =&gt; \%callbacks,
        }
    );
    $parser-&gt;run;
    $aggregator-&gt;add( $file, $parser );
}</code></pre>

<p>Callbacks may also be added like this:</p>

<pre><code>$parser-&gt;callback( test =&gt; \&amp;test_callback );
$parser-&gt;callback( plan =&gt; \&amp;plan_callback );</code></pre>

<p>The following keys allowed for callbacks. These keys are case-sensitive.</p>

<ul>

<li><p><code>test</code></p>

<p>Invoked if <code>$result-&gt;is_test</code> returns true.</p>

</li>
<li><p><code>version</code></p>

<p>Invoked if <code>$result-&gt;is_version</code> returns true.</p>

</li>
<li><p><code>plan</code></p>

<p>Invoked if <code>$result-&gt;is_plan</code> returns true.</p>

</li>
<li><p><code>comment</code></p>

<p>Invoked if <code>$result-&gt;is_comment</code> returns true.</p>

</li>
<li><p><code>bailout</code></p>

<p>Invoked if <code>$result-&gt;is_unknown</code> returns true.</p>

</li>
<li><p><code>yaml</code></p>

<p>Invoked if <code>$result-&gt;is_yaml</code> returns true.</p>

</li>
<li><p><code>unknown</code></p>

<p>Invoked if <code>$result-&gt;is_unknown</code> returns true.</p>

</li>
<li><p><code>ELSE</code></p>

<p>If a result does not have a callback defined for it, this callback will be invoked. Thus, if all of the previous result types are specified as callbacks, this callback will <i>never</i> be invoked.</p>

</li>
<li><p><code>ALL</code></p>

<p>This callback will always be invoked and this will happen for each result after one of the above callbacks is invoked. For example, if <a href="./Term::ANSIColor.html">Term::ANSIColor</a> is loaded, you could use the following to color your test output:</p>

<pre><code>my %callbacks = (
    test =&gt; sub {
        my $test = shift;
        if ( $test-&gt;is_ok &amp;&amp; not $test-&gt;directive ) {
            # normal passing test
            print color &#39;green&#39;;
        }
        elsif ( !$test-&gt;is_ok ) {    # even if it&#39;s TODO
            print color &#39;white on_red&#39;;
        }
        elsif ( $test-&gt;has_skip ) {
            print color &#39;white on_blue&#39;;

        }
        elsif ( $test-&gt;has_todo ) {
            print color &#39;white&#39;;
        }
    },
    ELSE =&gt; sub {
        # plan, comment, and so on (anything which isn&#39;t a test line)
        print color &#39;black on_white&#39;;
    },
    ALL =&gt; sub {
        # now print them
        print shift-&gt;as_string;
        print color &#39;reset&#39;;
        print &quot;\n&quot;;
    },
);</code></pre>

</li>
<li><p><code>EOF</code></p>

<p>Invoked when there are no more lines to be parsed. Since there is no accompanying <a href="./TAP::Parser::Result.html">TAP::Parser::Result</a> object the <code>TAP::Parser</code> object is passed instead.</p>

</li>
</ul>

<h1 id="TAP-GRAMMAR"><a class="permalink" href="./TAP::Parser.html#TAP-GRAMMAR">#</a><a id="TAP"></a>TAP GRAMMAR</h1>

<p>If you&#39;re looking for an EBNF grammar, see <a href="./TAP::Parser::Grammar.html">TAP::Parser::Grammar</a>.</p>

<h1 id="BACKWARDS-COMPATIBILITY"><a class="permalink" href="./TAP::Parser.html#BACKWARDS-COMPATIBILITY">#</a><a id="BACKWARDS"></a>BACKWARDS COMPATIBILITY</h1>

<p>The Perl-QA list attempted to ensure backwards compatibility with <a href="./Test::Harness.html">Test::Harness</a>. However, there are some minor differences.</p>

<h2 id="Differences"><a class="permalink" href="./TAP::Parser.html#Differences">#</a>Differences</h2>

<ul>

<li><p>TODO plans</p>

<p>A little-known feature of <a href="./Test::Harness.html">Test::Harness</a> is that it supported TODO lists in the plan:</p>

<pre><code class="plaintext">1..2 todo 2
ok 1 - We have liftoff
not ok 2 - Anti-gravity device activated</code></pre>

<p>Under <a href="./Test::Harness.html">Test::Harness</a>, test number 2 would <i>pass</i> because it was listed as a TODO test on the plan line. However, we are not aware of anyone actually using this feature and hard-coding test numbers is discouraged because it&#39;s very easy to add a test and break the test number sequence. This makes test suites very fragile. Instead, the following should be used:</p>

<pre><code class="plaintext">1..2
ok 1 - We have liftoff
not ok 2 - Anti-gravity device activated # TODO</code></pre>

</li>
<li><p>&#39;Missing&#39; tests</p>

<p>It rarely happens, but sometimes a harness might encounter &#39;missing tests:</p>

<pre><code class="plaintext">ok 1
ok 2
ok 15
ok 16
ok 17</code></pre>

<p><a href="./Test::Harness.html">Test::Harness</a> would report tests 3-14 as having failed. For the <code>TAP::Parser</code>, these tests are not considered failed because they&#39;ve never run. They&#39;re reported as parse failures (tests out of sequence).</p>

</li>
</ul>

<h1 id="SUBCLASSING"><a class="permalink" href="./TAP::Parser.html#SUBCLASSING">#</a>SUBCLASSING</h1>

<p>If you find you need to provide custom functionality (as you would have using <a href="./Test::Harness::Straps.html">Test::Harness::Straps</a>), you&#39;re in luck: <code>TAP::Parser</code> and friends are designed to be easily plugged-into and/or subclassed.</p>

<p>Before you start, it&#39;s important to know a few things:</p>

<ol>

<li><p>All <code>TAP::*</code> objects inherit from <a href="./TAP::Object.html">TAP::Object</a>.</p>

</li>
<li><p>Many <code>TAP::*</code> classes have a <i>SUBCLASSING</i> section to guide you.</p>

</li>
<li><p>Note that <code>TAP::Parser</code> is designed to be the central &quot;maker&quot; - ie: it is responsible for creating most new objects in the <code>TAP::Parser::*</code> namespace.</p>

<p>This makes it possible for you to have a single point of configuring what subclasses should be used, which means that in many cases you&#39;ll find you only need to sub-class one of the parser&#39;s components.</p>

<p>The exception to this rule are <i>SourceHandlers</i> &amp; <i>Iterators</i>, but those are both created with customizable <i>IteratorFactory</i>.</p>

</li>
<li><p>By subclassing, you may end up overriding undocumented methods. That&#39;s not a bad thing per se, but be forewarned that undocumented methods may change without warning from one release to the next - we cannot guarantee backwards compatibility. If any <i>documented</i> method needs changing, it will be deprecated first, and changed in a later release.</p>

</li>
</ol>

<h2 id="Parser-Components"><a class="permalink" href="./TAP::Parser.html#Parser-Components">#</a><a id="Parser"></a>Parser Components</h2>

<h3 id="Sources"><a class="permalink" href="./TAP::Parser.html#Sources">#</a>Sources</h3>

<p>A TAP parser consumes input from a single <i>raw source</i> of TAP, which could come from anywhere (a file, an executable, a database, an IO handle, a URI, etc..). The source gets bundled up in a <a href="./TAP::Parser::Source.html">TAP::Parser::Source</a> object which gathers some meta data about it. The parser then uses a <a href="./TAP::Parser::IteratorFactory.html">TAP::Parser::IteratorFactory</a> to determine which <a href="./TAP::Parser::SourceHandler.html">TAP::Parser::SourceHandler</a> to use to turn the raw source into a stream of TAP by way of <a href="./TAP::Parser.html#Iterators">&quot;Iterators&quot;</a>.</p>

<p>If you simply want <code>TAP::Parser</code> to handle a new source of TAP you probably don&#39;t need to subclass <code>TAP::Parser</code> itself. Rather, you&#39;ll need to create a new <a href="./TAP::Parser::SourceHandler.html">TAP::Parser::SourceHandler</a> class, and just plug it into the parser using the <i>sources</i> param to <a href="./TAP::Parser.html#new">&quot;new&quot;</a>. Before you start writing one, read through <a href="./TAP::Parser::IteratorFactory.html">TAP::Parser::IteratorFactory</a> to get a feel for how the system works first.</p>

<p>If you find you really need to use your own iterator factory you can still do so without sub-classing <code>TAP::Parser</code> by setting <a href="./TAP::Parser.html#iterator_factory_class">&quot;iterator_factory_class&quot;</a>.</p>

<p>If you just need to customize the objects on creation, subclass <a href="./TAP::Parser.html">TAP::Parser</a> and override <a href="./TAP::Parser.html#make_iterator_factory">&quot;make_iterator_factory&quot;</a>.</p>

<p>Note that <code>make_source</code> &amp; <code>make_perl_source</code> have been <i>DEPRECATED</i> and are now removed.</p>

<h3 id="Iterators"><a class="permalink" href="./TAP::Parser.html#Iterators">#</a>Iterators</h3>

<p>A TAP parser uses <i>iterators</i> to loop through the <i>stream</i> of TAP read in from the <i>source</i> it was given. There are a few types of Iterators available by default, all sub-classes of <a href="./TAP::Parser::Iterator.html">TAP::Parser::Iterator</a>. Choosing which iterator to use is the responsibility of the <i>iterator factory</i>, though it simply delegates to the <i>Source Handler</i> it uses.</p>

<p>If you&#39;re writing your own <a href="./TAP::Parser::SourceHandler.html">TAP::Parser::SourceHandler</a>, you may need to create your own iterators too. If so you&#39;ll need to subclass <a href="./TAP::Parser::Iterator.html">TAP::Parser::Iterator</a>.</p>

<p>Note that <a href="./TAP::Parser.html#make_iterator">&quot;make_iterator&quot;</a> has been <i>DEPRECATED</i> and is now removed.</p>

<h3 id="Results"><a class="permalink" href="./TAP::Parser.html#Results">#</a>Results</h3>

<p>A TAP parser creates <a href="./TAP::Parser::Result.html">TAP::Parser::Result</a>s as it iterates through the input <i>stream</i>. There are quite a few result types available; choosing which class to use is the responsibility of the <i>result factory</i>.</p>

<p>To create your own result types you have two options:</p>

<dl>

<dt id="option-1"><a class="permalink" href="./TAP::Parser.html#option-1">#</a><a id="option"></a>option 1</dt>
<dd>

<p>Subclass <a href="./TAP::Parser::Result.html">TAP::Parser::Result</a> and register your new result type/class with the default <a href="./TAP::Parser::ResultFactory.html">TAP::Parser::ResultFactory</a>.</p>

</dd>
<dt id="option-2"><a class="permalink" href="./TAP::Parser.html#option-2">#</a><a id="option1"></a>option 2</dt>
<dd>

<p>Subclass <a href="./TAP::Parser::ResultFactory.html">TAP::Parser::ResultFactory</a> itself and implement your own <a href="./TAP::Parser::Result.html">TAP::Parser::Result</a> creation logic. Then you&#39;ll need to customize the class used by your parser by setting the <code>result_factory_class</code> parameter. See <a href="./TAP::Parser.html#new">&quot;new&quot;</a> for more details.</p>

</dd>
</dl>

<p>If you need to customize the objects on creation, subclass <a href="./TAP::Parser.html">TAP::Parser</a> and override <a href="./TAP::Parser.html#make_result">&quot;make_result&quot;</a>.</p>

<h3 id="Grammar"><a class="permalink" href="./TAP::Parser.html#Grammar">#</a>Grammar</h3>

<p><a href="./TAP::Parser::Grammar.html">TAP::Parser::Grammar</a> is the heart of the parser. It tokenizes the TAP input <i>stream</i> and produces results. If you need to customize its behaviour you should probably familiarize yourself with the source first. Enough lecturing.</p>

<p>Subclass <a href="./TAP::Parser::Grammar.html">TAP::Parser::Grammar</a> and customize your parser by setting the <code>grammar_class</code> parameter. See <a href="./TAP::Parser.html#new">&quot;new&quot;</a> for more details.</p>

<p>If you need to customize the objects on creation, subclass <a href="./TAP::Parser.html">TAP::Parser</a> and override <a href="./TAP::Parser.html#make_grammar">&quot;make_grammar&quot;</a></p>

<h1 id="ACKNOWLEDGMENTS"><a class="permalink" href="./TAP::Parser.html#ACKNOWLEDGMENTS">#</a>ACKNOWLEDGMENTS</h1>

<p>All of the following have helped. Bug reports, patches, (im)moral support, or just words of encouragement have all been forthcoming.</p>

<ul>

<li><p>Michael Schwern</p>

</li>
<li><p>Andy Lester</p>

</li>
<li><p>chromatic</p>

</li>
<li><p>GEOFFR</p>

</li>
<li><p>Shlomi Fish</p>

</li>
<li><p>Torsten Schoenfeld</p>

</li>
<li><p>Jerry Gay</p>

</li>
<li><p>Aristotle</p>

</li>
<li><p>Adam Kennedy</p>

</li>
<li><p>Yves Orton</p>

</li>
<li><p>Adrian Howard</p>

</li>
<li><p>Sean &amp; Lil</p>

</li>
<li><p>Andreas J. Koenig</p>

</li>
<li><p>Florian Ragwitz</p>

</li>
<li><p>Corion</p>

</li>
<li><p>Mark Stosberg</p>

</li>
<li><p>Matt Kraai</p>

</li>
<li><p>David Wheeler</p>

</li>
<li><p>Alex Vandiver</p>

</li>
<li><p>Cosimo Streppone</p>

</li>
<li><p>Ville Skyttä</p>

</li>
</ul>

<h1 id="AUTHORS"><a class="permalink" href="./TAP::Parser.html#AUTHORS">#</a>AUTHORS</h1>

<p>Curtis &quot;Ovid&quot; Poe &lt;ovid@cpan.org&gt;</p>

<p>Andy Armstong &lt;andy@hexten.net&gt;</p>

<p>Eric Wilhelm @ &lt;ewilhelm at cpan dot org&gt;</p>

<p>Michael Peters &lt;mpeters at plusthree dot com&gt;</p>

<p>Leif Eriksen &lt;leif dot eriksen at bigpond dot com&gt;</p>

<p>Steve Purkis &lt;spurkis@cpan.org&gt;</p>

<p>Nicholas Clark &lt;nick@ccl4.org&gt;</p>

<p>Lee Johnson &lt;notfadeaway at btinternet dot com&gt;</p>

<p>Philippe Bruhat &lt;book@cpan.org&gt;</p>

<h1 id="BUGS"><a class="permalink" href="./TAP::Parser.html#BUGS">#</a>BUGS</h1>

<p>Please report any bugs or feature requests to <code>bug-test-harness@rt.cpan.org</code>, or through the web interface at <a href="http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Harness">http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Harness</a>. We will be notified, and then you&#39;ll automatically be notified of progress on your bug as we make changes.</p>

<p>Obviously, bugs which include patches are best. If you prefer, you can patch against bleed by via anonymous checkout of the latest version:</p>

<pre><code class="plaintext">git clone git://github.com/Perl-Toolchain-Gang/Test-Harness.git</code></pre>

<h1 id="COPYRIGHT-&amp;-LICENSE"><a class="permalink" href="./TAP::Parser.html#COPYRIGHT-&amp;-LICENSE">#</a><a id="COPYRIGHT"></a><a id="COPYRIGHT-LICENSE"></a>COPYRIGHT &amp; LICENSE</h1>

<p>Copyright 2006-2008 Curtis &quot;Ovid&quot; Poe, all rights reserved.</p>

<p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
